package com.invengo.testrfid.app.view;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.invengo.testrfid.R;

public class InitTagView extends LinearLayout {

    private PreOrNextView pn_init;
    private ShowTagView st_view;
    private TextView tv_cage_id;

    public InitTagView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);

        View inflate = LayoutInflater.from(context).inflate(R.layout.view_init_tag, this);
        pn_init = inflate.findViewById(R.id.pn_init);
        st_view = inflate.findViewById(R.id.st_view);
        tv_cage_id = inflate.findViewById(R.id.tv_cage_id);
    }

    public void initNextTitle(String nextTitle) {
        pn_init.initText(nextTitle);

    }

    public void initView(String tid, String epc, String editCage) {

        tv_cage_id.setText("集装箱编号：" + editCage);
        boolean b = st_view.initView(tid, epc, editCage);
        pn_init.initView(true, b);

    }

    /**
     * 上一条或者下一条的回调
     *
     * @param preOrNextCallback
     */
    public void addPreOrNextCallbace(PreOrNextView.PreOrNextCallback preOrNextCallback) {
        pn_init.setOnClickListenser(preOrNextCallback);
    }
}
